<template>
  <div>
    <van-nav-bar
      title="头筹"
      right-text="我的记录"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
    <div class="rule">
        <div>
            <h1><img src="static/PictureFish/规则.png" alt=""></h1>
            <p>每期n个名额，没包含一件高价值的商品，n件普通商品。所有用户以普通商品的市场价值参与购买，其中一人获得头筹商品和普通商品，其中用户获得普通产品。弱48小时内名额为满，则本期无效且自动退款</p>
            <h4>查看详细规则 》</h4>
        </div>
    </div>
    <div class="master">
        <hr class="line" />
        <span>头筹得主</span>
    </div>

    <div class="pre-masster">
            <div class="pre"  v-for="(item,index) in data" :key="index">
                <img src="static/PictureFish/头像 男孩.png" alt="">
                <h3>第{{item.commonProductPrice}}期</h3> 
                <p><span>{{item.id}}</span>获得头筹,以{{item.topProductPrice}}的价格购买到阿鲁护卫浮漂LPC01套装</p>
            </div>
    </div>

    <van-tabs id="tog"  v-model="activeName">
     <van-tab  title="正在头筹" name="a">
         <div class="van-ellipsis" v-for="(item,index) in data" :key="index">
             <div v-if="item.stateName ==='未开始'">
                <div class="ellipsis-top">
                 <div class="ellipsis-left"><h1><span>第{{item.topProductPrice}}期</span></h1>
                    <img :src="item.picturePath" alt="" class="picturePath">
                        <p>海龙王新款强丝版鱼线 50米 拉力强悍 切水迅猛</p>
                 </div>
                 <div class="ellipsis-right"><h1><span>本期头筹</span></h1>
                    <img :src="item.picturePath" alt="" class="picturePath">
                    <h2>价格：￥<span>{{item.topProductPrice}}</span>元</h2>
                    <p>黄金眼浮L1088(二目加粗尾)套装</p>
                 </div>
             </div>
             <div class="ellipsis-bottom">
                 <div>
                     <span>满6人揭晓</span><span>0/6</span>
                 </div>
                 <div>
                     <div>
                        <h2>￥<span>59.8</span></h2><span>(0人已购买)</span>
                     </div>
                   <button>去购买</button>
                 </div>
             </div>
             </div>
             
             
     </div>
         
         </van-tab>
     <van-tab title="拔得头筹" name="b">

         <div v-for="(item,index) in data" :key="index" class="ellipsis-old">
             <div v-if="item.stateName ==='开筹'">
             <h3>第{{item.commonProductPrice}}期</h3>
             <div class="ellipsisOld">
                 <img src="static/PictureFish/头像 男孩.png" alt="">
                 <div><h4>{{item.id}}</h4><span>广东 东湾 </span><p>以59.8元购买到龙纹锦鲤旗舰版3代5.4米鱼竿</p>
                 <span>参与实践:{{item.pickTime.slice(0,10)}}</span></div>
                 <div class="ellipsi-number">
                     <h1>头筹幸运号码</h1>
                 </div>
                 <div class="ellipsi-id">
                     <ul v-for="(ite,index) in item.topProductNum" :key = "index">
                         <li>{{ite}}</li>
                     </ul>
                 </div>
                 <div class="look">查看商品</div>
             </div>
             </div>

         </div>

       
     </van-tab>
    </van-tabs>
  </div>
</template>
<script>
import axios from 'axios';

import { Toast } from 'vant';
export default {
    data(){
        return{
            activeName: 'a',
            data:[]
        }
    },  
    mounted() {
    axios.post('/api/toplist').then(res => {
      this.data = res.data.data;
      console.log(this.data);
    });
  },
    methods: {
    onClickLeft() {
      Toast('返回');
    },
    onClickRight() {
      Toast('按钮');
    },
  },
}
</script>
<style scoped>
.rule{
        position: relative;
        width:100%;
        background-color: rgba(0, 0, 0, .8);
        height: 25rem;
        color: white;
}
.rule div{
        width: 30rem;
        height: 20rem;
        position: relative;
        padding-left:1rem ;
        padding-right:1rem ;
        top: 2rem;
        left: 3rem;
        border: 2px solid white;
}
    .rule div p{
        font-size: 1.4rem;
        margin-top: 1rem;
    }
    .rule div h1{
        position: relative;
        text-align: center;
        left: 8rem;
        width:14rem;
        top: -1.9rem;
    }
    .rule div h1 img{
      width:14rem;

    }
    .rule div h4{
        text-align: center;
        font-size: 1.5rem;
        position: relative;
        top: 2rem;
    }
.master span{
    width: 8rem;
    padding-left: 1rem;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    padding-right: 1rem;
    font-size: 1.8rem;
    text-align: center;
    background-color: rgb(255,0,0);
    position: relative;
    left: 14.5rem;
    color: white;
    border: none;
    top: -0.2rem;
}   

.picturePath{
    width: 100%;
}
.line{
            width: 100%;
            height: 3px;
             background: linear-gradient(to right,
			rgba(255,0,0, 0.4) 0%,
			rgba(255,0,0, 0.5) 10%,
			rgba(255,0,0, 0.7) 20%,
			rgba(255,0,0, 0.8) 30%,
			rgb(255,0,0) 50%,
			rgba(255,0,0, 0.8) 70%,
			rgba(255,0,0, 0.7) 80%,
			rgba(255,0,0, 0.5) 90%,
			rgba(255,0,0, 0.4) 100%);
}
.pre-masster{
    overflow: scroll;
    display: flex;
    flex-wrap:nowrap;
    margin-top: 1rem;
}
.pre-masster .pre{
    margin-left: 1rem;
    min-width: 24rem;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid red;
}
.pre-masster div img{
    float: left;
    margin-right: 0.5rem;
}
.pre-masster div span{
    color: red;
}

.van-ellipsis{
    padding: 1rem;
    background-color: rgba(0, 0, 0, .1);
}
.ellipsis-top{
    background-color: white;
    white-space:pre-wrap;
    display: flex;
}
.ellipsis-left{
    width: 160%;
    padding: 1rem;
}
.ellipsis-right{
    background-color: rgb(255,0,0);
    color: white;
    text-align: center;
    
}
.ellipsis-right h2{
    background-color: rgba(0, 0, 0, .8);
}
.ellipsis-bottom{
    margin-top: 1rem;
    background-color: white;
}
.ellipsis-bottom div{
    display: flex;
     justify-content:space-between;
     margin-bottom: 1rem;
}
.ellipsis-bottom h2{
    color: red;
}
.ellipsis-bottom button{
    width: 6rem;
    height: 3rem;
    color: white;
    background-color: red;
    border: none;
    border-radius: 6rem;
}


.ellipsis-old{
    margin-top: 2rem;
}

.ellipsis-old h3{
    color: red;
}
.ellipsisOld{
    padding: 1rem;
}
.ellipsisOld span{
    color: rgba(0, 0, 0, .6);
}
.ellipsisOld img{
    float: left;
}
.ellipsisOld h4{
    color: red;
    float: left;
}
.ellipsi-number{
       background: linear-gradient(to right,
			rgba(255,215,0, 0.4) 0%,
			rgba(255,215,0, 0.5) 10%,
			rgba(255,215,0, 0.7) 20%,
			rgba(255,215,0, 0.8) 30%,
			rgb(255,215,0) 50%,
			rgba(255,215,0, 0.8) 70%,
			rgba(255,215,0, 0.7) 80%,
			rgba(255,215,0, 0.5) 90%,
			rgba(255,215,0, 0.4) 100%);
            width: 20rem;
            text-align: center;
            position: relative;
            left: 8rem;
}

.ellipsi-id{
}
.ellipsi-id ul{
    position: relative;
    left: 6.5rem;
    top:1rem;

}
.ellipsi-id ul li{
    position: relative;
    float: left;
    color: red;
    font-size: 2rem;
    box-shadow:  1px 1px 1px 1px #000;
    margin-left: 1rem;
    padding: 0.3rem;
}
.look{
    position: relative;
    top: 6rem;
    left: -12rem;
    text-align: center;
}
</style>
